package com.power.sifa.std.model;


import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
*  行政管理单位实体类
*/

@Entity
@ApiModel(value="行政管理单位")
@Data
@Table(name="Std_admunit",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Std_admunit.Std_admunitPK.class) 用于复合组件
public class Std_admunit extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "组织机构代码")
    private String id;

    @ApiModelProperty(value = "单位名称")
    private String name;

    @ApiModelProperty(value = "所属行政区划")
    @NotNull
    private String adid;

    @ApiModelProperty(value = "顺序")
    @NotNull
    private Integer sortnum;

    @ApiModelProperty(value = "引用类型id")
    @NotNull
    private String typeid = "0";


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("name", this.getName());
        map.put("adid", this.getAdid());
        map.put("sortnum", this.getSortnum());
        map.put("typeid", this.getTypeid());
        return map;
    }
    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Std_admunitPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Std_admunitPK pk = (Std_admunitPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
